package modelLayer;
import java.util.ArrayList;

/**
 * Lav en beskrivelse af klassen Loan her.
 * 
 * @author (dit navn her)
 * @version (versions nummer eller dato her)
 */
public class Loan
{
    // instansvariabler - erstat eksemplet herunder med dine egne variabler
    private int id;
    private String borrowDate;
    private String period;
    private ArrayList<PartLoan> partLoanList;
    private Person personsLoan;

    public Loan(int id, String period, String borrowDate, Person personsLoan)
    {
        this.id = id;
        this.borrowDate = borrowDate;
        this.period = period;
        this.personsLoan = personsLoan;
        this.partLoanList = new ArrayList<PartLoan>();
    
    }
    
    public int getId()
    {
        return id;
    }
    
    public void setId(int id)
    {
        this.id = id;
    }
   
    public String getBorrowDate()
    {
        return borrowDate;
    }
    
    public void setBorrowDate(String borrowDate)
    {
        this.borrowDate = borrowDate;
    }
    
    public String getPeriod()
    {
        return period;
    }
    
    public void setPeriod(String period)
    {
        this.period = period;
    }
    
    public Person getPersonsLoan()
    {
        return personsLoan;
    }
    
    public void addPartLoan(PartLoan partLoan)
    {
        partLoanList.add(partLoan);
    }
    
    public ArrayList<PartLoan> getPartLoans()
    {
        return partLoanList;
    }
    
    public void removePartLoan(PartLoan partLoan)
    {
        partLoanList.remove(partLoan);
    }
    
    public boolean isEmpty()
    {
        return partLoanList.size() == 0;
    }
}
